import axios from '@/libs/api.request'

export const Login = (data) => {
    return axios.request({
        method: "post",
        url: '/login',
        data: data,
    })
}

export const Register = (data) => {
    return axios.request({
        method: "post",
        url: '/register',
        data: data,
    })
}
export const getStudentData = () => {
    return axios.request({
        method: "get",
        url: '/students',
    })
}

export const getMsgData = () => {
    return axios.request({
        method: "get",
        url: '/msg',
    })
}

export const getHistoryData = () => {
    return axios.request({
        method: "get",
        url: '/history',
    })
}



export const addStudentData = (data) => {
    return axios.request({
        method: "post",
        url: '/students/new',
        data: data
    })
}

export const deleteStudentData = (id) => {
    return axios.request({
        method: "get",
        url: '/students/delete',
        params: {
            id
        }
    })
}

export const editStudentData = (id) => {
    return axios.request({
        method: "get",
        url: '/students/edit',
        params: {
            id
        }
    })
}

export const editStudentPostData = (data) => {
    return axios.request({
        method: "post",
        url: '/students/edit',
        data: data
    })
}

export const deleteMsgData = (id) => {
    return axios.request({
        method: "get",
        url: '/msg/delete',
        params: {
            id
        }
    })
}

export const addMsgData = (data) => {
    return axios.request({
        method: "post",
        url: '/msg/new',
        data: data
    })
}

export const deleteHistoryData = (id) => {
    return axios.request({
        method: "get",
        url: '/history/delete',
        params: {
            id
        }
    })
}

export const addHistoryData = (data) => {
    return axios.request({
        method: "post",
        url: '/history/new',
        data: data
    })
}